﻿using MediatR;
using W.Warehouse.Domain.Reportlosses;
using W.Warehouse.Read.Api.Application.Command.ReportlossesCommand;
using W.Warehouse.Repository.Interface;

namespace W.Product.API.Appliaction.CommandHandler.ReportlossesCommandHandler
{
    public class ReportlossesFindCommandHandler : IRequestHandler<ReportlossesFindCommand, ReportlossesInfo>
    {
        private readonly IReportlossesRepository _reportlossesRepository;
        public ReportlossesFindCommandHandler(IReportlossesRepository reportlossesRepository)
        {
            _reportlossesRepository = reportlossesRepository;
        }
        /// <summary>
        /// 报损管理反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<ReportlossesInfo> Handle(ReportlossesFindCommand request, CancellationToken cancellationToken)
        {
            var list = await _reportlossesRepository.GetModelAsync(request.ReportlossesId);
            return list;
        }
    }
}
